﻿//**********************************************************
//Copyright(C)2010 By 波特商网公司 版权所有。
//
//文件名：
//文件功能
//
//创建标识：
//
//修改标识：
//修改描述：
//**********************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace Hmc.IM.Common.UserControls
{
    /// <summary>
    /// 增加活动时显示的图片属性
    /// </summary>
    public class ucPictureBox : PictureBox
    {
        private Image currentImage;
        /// <summary>
        /// 鼠标进入控件时显示的图片
        /// </summary>
        public Image CurrentImage
        {
            get { return currentImage; }
            set { currentImage = value; }
        }

        private Image groundImage;

        /// <summary>
        /// 鼠标移入事件
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseEnter(EventArgs e)
        {
            base.OnMouseEnter(e);
            if (this.CurrentImage != null)
            {
                groundImage = this.BackgroundImage;
                this.BackgroundImage = this.CurrentImage;
            }
        }

        /// <summary>
        /// 鼠标移出事件
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);
            this.BackgroundImage = groundImage;
        }
    }
}
